<template>
    <div>
        <h2 class="ss">用户名{{name}}</h2>
        <h2>年龄{{age}}</h2>
        <h2>性别{{sex}}</h2>
        <h2>家庭住址{{address}}</h2>
    </div>
</template>

<script>
export default {
    name: 'User',
    data(){
        return {
            name:'username',
            age:'18',
            sex:'男',
            address:'地球'
        }
    },
    methods: {
        getName(){
            console.log(this.name)
        },
    },mounted() {
        // 给 $bus 绑定自定义事件
        this.$bus.$on('xxx', (data) => {
            console.log("接收信息:"+data)
        })
    }

}
</script>

<style scoped >
    .ss{
        color: red;
    }
</style>